#ifndef DATABASEMONITOR_H
#define DATABASEMONITOR_H

#include <QMainWindow>
#include <QDialog>
#include <QModelIndex>

class QDialogButtonBox;
class QPushButton;
class QSqlTableModel;

class DatabaseMonitor : public QDialog
{
    Q_OBJECT

public:
    DatabaseMonitor(const QString &tableName, QWidget *parent = 0);

private slots:
    void open();
    void del();
    void submit();
    void selected(QModelIndex);
    void entered(QModelIndex,QModelIndex);

private:
    bool createConnection();
    bool changeConnection();

    QPushButton *openButton;
    QPushButton *saveButton;
    QPushButton *delButton;
    QPushButton *revertButton;
    QPushButton *quitButton;
    QDialogButtonBox *buttonBox;
    QSqlTableModel *model;

    QString fileName;
    int selectedRow;
};

#endif // DATABASEMONITOR_H
